feat: read an account's per-network metric set - #26
Merged
Merged
Conversation
accounts.platform_metrics answers in the platform's own vocabulary rather than the cross-network one: ad-break earnings, story taps, a retention curve, the search terms behind a listing. Needs the analytics scope, and a network whose access is still pending answers 503 platform_metrics_unavailable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reads the metric set only an account's own network reports, in the platform's own vocabulary rather than the cross-network one: ad-break earnings on a monetised Facebook Page, how viewers left an Instagram story, a YouTube retention curve and daily views, LinkedIn reactions split by type, the search terms behind a Google Business listing.
Answers from the newest collected snapshot rather than a live call to the network. Each row carries the platform's own
key(stable — match on this), alabel(ours, and subject to rewording), akindofcount,duration_ms,currency_usd,ratioorseries, and the value. Aseriesvalue is an array of points where every other kind is a number, so the value keeps its raw form and a helper decodes the common numeric case.Needs the
analyticsscope. A network whose metric access has been requested but not granted answers503 platform_metrics_unavailablerather than an empty set, so a pending grant never reads as a zero.Tests cover the request path and query, the parsed set, a series value surviving intact, and the 503.
Depends on the API change in fopost/fopost#1002.